package second.progr.helpstaff;

import java.util.ArrayList;
import java.util.List;

public class FoldersList {
  
	 private List<String> storedFolders = null;
	 
	 public FoldersList(List<String> fold) {
		 this.storedFolders = new ArrayList<String>(fold);
	 }
	 
	 public FoldersList withAdded(String fold){
		 FoldersList newList = new FoldersList(storedFolders);
		 newList.storedFolders.add(fold);
		 return newList;
	 }
	 
	 public FoldersList withOut(String fold){
		 FoldersList newList = new FoldersList(storedFolders);
		 newList.storedFolders.remove(fold);
		 return newList;
	 }
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((storedFolders == null) ? 0 : storedFolders.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FoldersList other = (FoldersList) obj;
		if (storedFolders == null) {
			if (other.storedFolders != null)
				return false;
		} else if (!storedFolders.equals(other.storedFolders))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "FoldersList [" + storedFolders + "]";
	}
	   
}